<?php
/**
 * Nadëb (Makú-Nadëb)
 *
 * @filesource 
 * @copyright  Copyright 2010 mateusweb.com.br
 * @license    Freeware
 * @package    Nadeb_Data_Report
 * @subpackage Nadeb.Grid.Sql
 * @version    2.0
 */

abstract class Nadeb_Report_Footer
{
	public static function get_xhtml($_footerConfigs)
	{
		$params     = $_footerConfigs["params"];
		$atual_page = $_footerConfigs["page"];
		$totalPages = $_footerConfigs["totalPages"];
		
		$url_path  = "/";
		$url_path .= $params['module']     . "/";
		$url_path .= $params['controller'] . "/";
		$url_path .= $params['action'];
		if(isset($params['rel']))
			$url_path .=  "/rel/" . $params['rel'];

		if($atual_page > 1) $url = $url_path . "/pg/" . ($atual_page-1); else $url = $url_path . "/pg/1";
		$links = "<a href=\"{$url}\" class=\"anterior\"> « Anterior </a>";
		
		for($i=1; $i<$totalPages; $i++)
			$links .= "<a href=\"" . $url_path . "/pg/" . $i ."\" class=\"navegador\"> $i </a>";
		
		if($atual_page < $totalPages) $url = $url_path . "/pg/" . ($atual_page+1); else $url = $url_path . "/pg/" . $totalPages;			
		$links .= "<a href=\"{$url}\" class=\"proximo\"> Próximo » </a>";
				
		$gd  = "\t\t\t<tfoot>\n\t\t\t\t<tr>\n";
		if($totalPages > 1)
			$gd .= "\t\t\t\t\t<td colspan=\"99\">$links</td>\n";
		else
			$gd .= "\t\t\t\t\t<td colspan=\"99\">&nbsp;</td>\n";
		$gd .= "\t\t\t\t</tr>\n\t\t\t</tfoot>\n";
		return $gd;
	}
}
